
import java.util.ArrayList;
import java.util.List;

// 学院类
class School {
    private String name;
    private List<Department> departments;
    private List<Student> students;

    public School(String name) {
        this.name = name;
        this.departments = new ArrayList<>();
        this.students = new ArrayList<>();
    }

    // 添加系
    public void addDepartment(Department department) {
        departments.add(department);
    }

    // 添加学生
    public void addStudent(Student student) {
        students.add(student);
    }

    // 获取系列表
    public List<Department> getDepartments() {
        return departments;
    }

    // 获取学生列表
    public List<Student> getStudents() {
        return students;
    }
}

// 系类
class Department {
    private String name;
    private List<Instructor> instructors;
    private List<Subject> subjects;

    public Department(String name) {
        this.name = name;
        this.instructors = new ArrayList<>();
        this.subjects = new ArrayList<>();
    }

    // 添加指导教师
    public void addInstructor(Instructor instructor) {
        instructors.add(instructor);
    }

    // 添加课程
    public void addSubject(Subject subject) {
        subjects.add(subject);
    }

    // 获取指导教师列表
    public List<Instructor> getInstructors() {
        return instructors;
    }

    // 获取课程列表
    public List<Subject> getSubjects() {
        return subjects;
    }
}

// 指导教师类
class Instructor {
    private String name;
    private Department department;
    private List<Subject> subjects;

    public Instructor(String name, Department department) {
        this.name = name;
        this.department = department;
        this.subjects = new ArrayList<>();
    }

    // 添加教授的课程
    public void addSubject(Subject subject) {
        subjects.add(subject);
    }

    // 获取教授的课程列表
    public List<Subject> getSubjects() {
        return subjects;
    }
}

// 课程类
class Subject {
    private String name;
    private Department department;

    public Subject(String name, Department department) {
        this.name = name;
        this.department = department;
    }
}

// 学生类
class Student {
    private String name;
    private List<Subject> subjects;

    public Student(String name) {
        this.name = name;
        this.subjects = new ArrayList<>();
    }

    // 添加选修的课程
    public void addSubject(Subject subject) {
        subjects.add(subject);
    }

    // 获取选修的课程列表
    public List<Subject> getSubjects() {
        return subjects;
    }
}

public class Main {
    public static void main(String[] args) {
        // 创建学院
        School school = new School("My University");

        // 创建系
        Department department1 = new Department("Computer Science");
        Department department2 = new Department("Mathematics");
        school.addDepartment(department1);
        school.addDepartment(department2);

        // 创建指导教师
        Instructor instructor1 = new Instructor("Professor Smith", department1);
        Instructor instructor2 = new Instructor("Professor Jones", department2);
        department1.addInstructor(instructor1);
        department2.addInstructor(instructor2);

        // 创建课程
        Subject subject1 = new Subject("Introduction to Programming", department1);
        Subject subject2 = new Subject("Calculus 1", department2);
        department1.addSubject(subject1);
        department2.addSubject(subject2);

        // 创建学生
        Student student1 = new Student("John Doe");
        Student student2 = new Student("Jane Doe");
        school.addStudent(student1);
        school.addStudent(student2);

        // 学生选课
        student1.addSubject(subject1);
        student2.addSubject(subject2);

        // 指导教师教授课程
        instructor1.addSubject(subject1);
        instructor2.addSubject(subject2);

        // 打印信息
        System.out.println("School Name: " + school.getName());
        System.out.println("Departments:");
        for (Department department : school.getDepartments()) {
            System.out.println("- " + department.getName());
            System.out.println("  Instructors:");
            for (Instructor instructor : department.getInstructors()) {
                System.out.println("    - " + instructor.getName());
                System.out.println("      Subjects:");
                for (Subject subject : instructor.getSubjects()) {
                    System.out.println("        - " + subject.getName());
                }
            }
            System.out.println("  Subjects:");
            for (Subject subject : department.getSubjects()) {
                System.out.println("    - " + subject.getName());
            }
        }
        System.out.println("Students:");
        for (Student student : school.getStudents()) {
            System.out.println("- " + student.getName());
            System.out.println("  Subjects:");
            for (Subject subject : student.getSubjects()) {
                System.out.println("    - " + subject.getName());
            }
        }
    }
}
